//
//  baseViewController.m

#import "baseViewController.h"
#import "UIViewController+Nav.h"

@interface baseViewController ()
//返回按钮
@property (nonatomic, strong) UIButton *backBtn;
@end

@implementation baseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationController.navigationBar.hidden = YES;
    self.navLab = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 64)];
    self.navLab.backgroundColor = [UIColor whiteColor];
    self.navLab.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:self.navLab];
    
    self.backBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 64, 64)];
    self.backBtn.backgroundColor = [UIColor redColor];
    [self.backBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.backBtn];
    
}

-(void)backAction{
    UIViewController *baseVc = [[UIApplication sharedApplication].delegate window].rootViewController;
    [baseVc.SYNavigationController popViewControllerAnimated:YES];
}

-(void)pushWithNextViewController:(UIViewController *)nextVc{
    UIViewController *baseVc = [[UIApplication sharedApplication].delegate window].rootViewController;
    [baseVc.SYNavigationController pushViewController:nextVc animated:YES];
}

- (void)viewWillAppear:(BOOL)animated
{
    //默认隐藏 tabbar
    ((SYTabbarController *)self.tabBarController).dock.hidden = YES;
    if (self.tabbarShow) {
        ((SYTabbarController *)self.tabBarController).dock.hidden = NO;
    }
    
    //返回按钮
    self.backBtn.hidden = NO;
    if (self.backBtnHidden) {
        self.backBtn.hidden = YES;
    }
}

@end
